package com.yiyi.credit.manage.abutment.client;



import com.yiyi.credit.manage.abutment.common.bean.Response;
import com.yiyi.credit.manage.model.dto.SysResourceDto;
import com.yiyi.credit.manage.model.entity.CookieInfo;
import com.yiyi.credit.manage.model.vo.PaginationVo;
import com.yiyi.credit.manage.model.vo.SysResourceVo;
import com.yiyi.credit.manage.model.vo.SysUserVo;
import com.yiyi.credit.manage.model.vo.UserInfoVo;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;


@FeignClient(value = "yiyi-credit-manage-sso-api")
public interface UserAuthorityManagementClient {


    @RequestMapping(value = "/userapi/system/user/getSysInfoId", method = RequestMethod.POST)
    Long getSysInfoId(@RequestParam(value = "sysInfoName") String sysInfoName);


    @RequestMapping(value = "/userapi/system/user/getSysUserId", method = RequestMethod.POST)
    Long getSysUserId(@RequestParam(value = "userName") String userName);


    @RequestMapping(value = "/userapi/system/user/getPhoneByUserName", method = RequestMethod.POST)
    Map<String, String> getPhoneByUserName(@RequestParam(value = "userName") String userName);


    @RequestMapping(value = "/userapi/system/user/loginSysUser", method = RequestMethod.POST)
    Response<CookieInfo> login(@RequestParam(value = "userName") String userName,
                               @RequestParam(value = "password") String password);


    @RequestMapping(value = "/userapi/system/user/authToken", method = RequestMethod.POST)
    Response authToken(@RequestParam(name = "token") String token);


    @RequestMapping(value = "/userapi/system/user/getSysUserInfoByToken", method = RequestMethod.POST)
    Response<UserInfoVo> getSysUserInfoByToken(@RequestParam(name = "token") String token,
                                               @RequestParam(value = "sysInfoId") Long sysInfoId);


    @RequestMapping(value = "/userapi/system/user/logout", method = RequestMethod.POST)
    Response logout(@RequestParam(name = "tokenVal") String tokenVal);


    @RequestMapping(value = "/userapi/system/user/changePwdSysUser", method = RequestMethod.POST)
    Response changePwdSysUser(@RequestParam(name = "userName") String userName, @RequestParam(name = "oldPwd") String oldPwd,
                              @RequestParam(name = "newPwd") String newPwd);


    @RequestMapping(value = "/userapi/system/user/getSysUserInfo", method = RequestMethod.POST)
    Response<SysUserVo> getSysUserInfo(@RequestParam(value = "sysUserId") Long sysUserId);


    @RequestMapping(value = "/userapi/permission/getSysUserPermission", method = RequestMethod.POST)
    Response<List<SysResourceVo>> getSysUserPermission(@RequestParam(value = "userId") Long userId,
                                                       @RequestParam(value = "sysInfoId") Long sysInfoId);


    @RequestMapping(value = "/userapi/permission/getSysChildNodePermission", method = RequestMethod.POST)
    Response<SysResourceDto> getSysChildNodePermission(@RequestParam(value = "userId") Long userId,
                                                       @RequestParam(value = "sysInfoId") Long sysInfoId,
                                                       @RequestParam(value = "pid", defaultValue = "-1") Long pid,
                                                       @RequestParam(value = "whetherAllChild") boolean whetherAllChild);


    @RequestMapping(value = "/userapi/permission/getSysUserPermissionByUrl", method = RequestMethod.POST)
    Response<SysResourceDto> getSysUserPermissionByUrl(@RequestParam(value = "userId") Long userId,
                                                       @RequestParam(value = "sysInfoId") Long sysInfoId,
                                                       @RequestParam(value = "url") String url);


    @RequestMapping(value = "/userapi/system/user/getUserAllInfoList", method = RequestMethod.POST)
    public PaginationVo getUserAllInfoList(@RequestParam(value = "sysInfoId") Long sysInfoId,
                                           @RequestParam(value = "userName") String userName,
                                           @RequestParam(value = "realName") String realName,
                                           @RequestParam(value = "roleNameId") Long roleNameId,
                                           @RequestParam(value = "status") Long status,
                                           @RequestParam(value = "pageIndex") int pageIndex,
                                           @RequestParam(value = "pageSize") int pageSize);


    @RequestMapping(value = "/userapi/system/user/getUserInfoByIds", method = RequestMethod.POST)
    public List<UserInfoVo> getUserInfoByIds(@RequestParam(value = "sysInfoId") Long sysInfoId,
                                             @RequestParam(value = "ids") String ids);


    @RequestMapping(value = "/userapi/system/user/updatePhone", method = RequestMethod.POST)
    public Object updatePhone(@RequestParam(value = "sysInfoId") Long sysInfoId,
                              @RequestParam(value = "userName") String userName,
                              @RequestParam(value = "password") String passWord,
                              @RequestParam(value = "newPhone") String newPhone);


    @RequestMapping("/userapi/system/user/getEmailByUsername")
    public String getEmailByUsername(@RequestParam("username") String username);
}
